]> dgit.raspbian.org Git - gnome-shell.git/commit
signalTracker: Remove SignalTracker after its last signal got untracked
authorSebastian Keller <skeller@gnome.org>
Sun, 28 Aug 2022 22:03:50 +0000 (00:03 +0200)
committerMarge Bot <marge-bot@gnome.org>
Sat, 3 Sep 2022 15:11:46 +0000 (15:11 +0000)
commit91ce5ca960879dbe810cde43265d00b5c6446a1a
tree8ddb9427e50664ce4934dc55bb2c656414e51c98
parent54ee728aa088f12cfb67e006cf75d9bbe5964b7a
signalTracker: Remove SignalTracker after its last signal got untracked

The object the SignalTracker belongs to is stored in a map managed by
the SignalManager which keeps a reference to that object. This map is
never destroyed nor is any entry ever removed. This leads to all objects
that ever had SignalTrackers used on them being kept alive even after
all references outside of the SignalTracker are long gone. This then
also extends to other objects which are leaked indirectly through
reference chains from these objects.

And if some of those objects are GObjects, this will prevent them from
being finalized, leaking further resources. A StWidget for example will
not release its shadow textures.

Fix this by destroying the SignalTracker and removing it from the
SignalManager once the last signal it was tracking has been untracked.

A WeakMap could have been used as well, but we need the Map to be
iterable in some of the following changes.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5807
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5796
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2466>
js/misc/signalTracker.js